<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>{:session('cp.cpsysname')}--系统管理平台</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
    <meta name="description" content="{:config('webconfig.description');}">
    <meta name="keywords" content="{:config('webconfig.keywords');}">
    <meta name="author" content="runoob">
    <link rel="stylesheet" href="__STATIC_URL__/static/css/bootstrapSwitch.css">
    <link rel="stylesheet" href="__STATIC_URL__/static/css/bootstrap.css">
    <link rel="stylesheet" type="text/css" href="__STATIC_URL__/static/css/index.css"/>
    <link href="https://cdn.bootcss.com/bootstrap-select/2.0.0-beta1/css/bootstrap-select.css" rel="stylesheet">
    <script src="__STATIC_URL__/static/js/jquery-2.1.4.min.js"></script>
    <script src="__STATIC_URL__/static/bootstrap/3.3.7/js/bootstrap.min.js"></script>
    <script src="__STATIC_URL__/static/js/bootstrapSwitch.js"></script>
    <script src="__STATIC_URL__/static/layer/layer.js"></script>
    <script src="https://cdn.bootcss.com/bootstrap-select/2.0.0-beta1/js/bootstrap-select.js"></script>
</head>
<body>
{include file='public/header'/}
<!------------------导航-------------------------->
<section>
    {include file='public/left'/}
    <!--------------------------主要内容区域------------------------------------->
    <div class="content">
        <div class="page-heading mgl15 mgr15">
            <ul class="breadcrumb">
                <li>当前位置是&nbsp;:</li>
                <li><a href="javascript:history.back();">系统管理</a></li>
                <li class="active" style="color: #02b87f;"> 系统用户管理</li>
            </ul>
        </div>
        <div class="panel mgr15 mgl15">
            <div class="panel-heading addCharts" style="background:#ededed;">
                添加用户
            </div>
            <div class="panel-body">
                <form class="form-horizontal adminex-form" action='' method="post" id="sysuser" enctype="multipart/form-data">
                    <div class="form-group" id="ferror5">
                        <label class="col-sm-2 control-label">员工角色：</label>
                        <div class="col-sm-10">
                            <select class="form-control" name='level' id='level' style="width:70%;">
                                <option value=''>请选择角色</option>
                                {volist name="dice" id="level"}
                                <option value='{$level.value}'>{$level.text}</option>
                                {/volist}
                            </select>
                            <div id="error5" class="error"></div>
                        </div>
                    </div>
                    <div class="form-group" id="ferror1" >
                        <label class="col-sm-2 control-label">姓名：</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" id='xingming' name='xingming' style="width:70%;">
                        </div>
                    </div>
                    <div class="form-group" id="ferror3" >
                        <label class="col-sm-2 control-label">手机号：</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" oninput="this.value=this.value.replace(/\D/g,'')" id='tel' name='tel' style="width:70%;" autocomplete="off" disableautocomplete>
                        </div>
                    </div>
                    <div class="form-group" id="ferror7" >
                        <label class="col-sm-2 control-label">账号：</label>
                        <div class="col-sm-10">
                            <input type="text" style="background:#fff;width:70%;" readonly onfocus="this.removeAttribute('readonly');" class="form-control" id='username' name='username' autocomplete="off" disableautocomplete>
                        </div>
                    </div>
                    <div class="form-group" id="ferror2">
                        <label class="col-sm-2 control-label">密码：</label>
                        <div class="col-sm-10">
                            <input type="password" style="background:#fff;width:70%;" readonly onfocus="this.removeAttribute('readonly');"  id='password' name='password' class="form-control" autocomplete="off" disableautocomplete >
                        </div>
                    </div>
                    <div class="form-group" id="ferror8">
                        <label class="col-sm-2 control-label">隶属OEM商：</label>
                        <div class="col-sm-10">
                            <select class="form-control" name='sysid' id='sysid' style="width:70%;">
                                <option value=''>请选择隶属OEM商</option>
                                {volist name="oemlist" id="level"}
                                <option value='{$level.id}'>{$level.gs_name}</option>
                                {/volist}
                            </select>
                            <div id="ferror81" class="error"></div>
                        </div>
                    </div>
                    <div style="text-align: center">
                        <button type="button" onclick="addform()" class="btn btn-primary">添加用户</button>
                    </div>
                </form>
            </div>
        </div>
        {include file='public/footer'/}
    </div>
</section>
<script>
    function addform() {
        var username = $('#username').val();
        var password = $('#password').val();
        var tel = $("#tel").val();
        var xingming = $("#xingming").val();
        var sysid = $("#sysid").val();
        var level = $("#level").val();
        if(sysid==""){
            layer.alert('请选择隶属OEM商');
            $('#sysid').focus();
            return;

        }
        if(level==""){
            layer.alert('请选择用户角色');
            $('#level').focus();
            return;

        }
        if(xingming==""){
            layer.alert('姓名不能为空');
            $('#xingming').focus();
            return;
        }
        if(tel==""){
            layer.alert('手机号不能为空');
            $('#tel').focus();
            return;
        }
        if (username === '') {
            layer.alert('用户名不能为空');
            $('#username').focus();
            return;

        }
        if (password === '') {
            layer.alert('用户密码不能为空');
            $('#password').focus();
            return;

        }
        $('#sysuser').submit();
    }
</script>
</body>
</html>
